package com.ruoyi.system.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.AdminDivisionModel;
import com.ruoyi.system.service.AdminDivisionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin-division")
public class AdminDivisionController {

    @Autowired
    private AdminDivisionService adminDivisionService;

    @PostMapping("/search_info_by_name")
    public R searchInfoByName(@RequestParam(value = "name", required = true, defaultValue = "") String name) {
        QueryWrapper<AdminDivisionModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("RG_NAME", name);
        AdminDivisionModel adminDivisionModel= adminDivisionService.getOne(queryWrapper);
        return R.ok(adminDivisionModel);
    }
}
